Write-Host "正在启动知识问答系统（API + Web）..." -ForegroundColor Green
Write-Host ""

# 启动API服务
Write-Host "启动API服务..." -ForegroundColor Cyan
$apiJob = Start-Job -ScriptBlock {
    Set-Location "C:\Users\Administrator\Desktop\ai学习\16 Coze工作原理与应用实例\16-Coze工作原理及应用开发\知识问答1\src\KnowledgeQA.API"
    dotnet run
}

# 等待API服务启动
Write-Host "等待API服务启动..." -ForegroundColor Yellow
Start-Sleep -Seconds 5

# 启动Web服务
Write-Host "启动Web服务..." -ForegroundColor Cyan
$webJob = Start-Job -ScriptBlock {
    Set-Location "C:\Users\Administrator\Desktop\ai学习\16 Coze工作原理与应用实例\16-Coze工作原理及应用开发\知识问答1\src\KnowledgeQA.Web"
    dotnet run
}

Write-Host ""
Write-Host "项目启动完成！" -ForegroundColor Green
Write-Host ""
Write-Host "访问地址：" -ForegroundColor Yellow
Write-Host "- API文档: http://localhost:5000/swagger" -ForegroundColor Cyan
Write-Host "- 健康检查: http://localhost:5000/health" -ForegroundColor Cyan
Write-Host "- 后台管理: http://localhost:5001" -ForegroundColor Cyan
Write-Host ""

# 显示后台管理页面地址
Write-Host "后台管理页面地址：" -ForegroundColor Magenta
Write-Host "http://localhost:5001" -ForegroundColor White -BackgroundColor DarkBlue
Write-Host ""

Write-Host "按 Ctrl+C 停止所有服务" -ForegroundColor Red

# 等待用户输入
Read-Host "按回车键退出"

# 停止所有作业
Get-Job | Stop-Job
Get-Job | Remove-Job 